package web.suzy.oj.service.oj.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.stereotype.Service;
import web.suzy.oj.common.result.ResultBean;
import web.suzy.oj.manager.oj.HomeManager;
import web.suzy.oj.pojo.vo.AnnouncementVO;
import web.suzy.oj.service.oj.HomeService;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * YangSuzy 软件工作室
 * 类名: HomeServiceImpl
 * 描述: ---- 待定 -----
 * 功能: ---- 待定 -----
 *
 * @author YangSuzy
 * Date: 2022/11/16 19:03
 */
@Service
public class HomeServiceImpl implements HomeService {

    @Resource
    private HomeManager homeManager;

    /**
     * 方法名: getWebConfig
     * 描述: 获取网站基本信息和配置
     *
     * @return web.suzy.oj.common.result.ResultBean<java.util.Map < java.lang.Object, java.lang.Object>>
     * @date 2022/11/16 19:03
     * @auther YangSuzy
     **/
    @Override
    public ResultBean<Map<Object, Object>> getWebConfig() {
        return ResultBean.successResponse(homeManager.getWebConfig());
    }

    /**
     * 方法名: getCommonAnnouncement
     * 描述: 获取主页公告列表
     *
     * @param limit       每页显示数目
     * @param currentPage 当前页
     * @return web.suzy.oj.common.result.ResultBean<com.baomidou.mybatisplus.core.metadata.IPage < web.suzy.oj.pojo.vo.AnnouncementVO>>
     * @date 2022/11/27 11:38
     * @auther YangSuzy
     **/
    @Override
    public ResultBean<IPage<AnnouncementVO>> getCommonAnnouncement(Integer limit, Integer currentPage) {
        return ResultBean.successResponse(homeManager.getCommonAnnouncement(limit, currentPage));
    }

    /**
     * 方法名: getHomeCarousel
     * 描述: 获取主页轮播图
     *
     * @return web.suzy.oj.common.result.ResultBean<java.util.List < java.util.HashMap < java.lang.String, java.lang.Object>>>
     * @date 2022/12/10 18:14
     * @auther YangSuzy
     **/
    @Override
    public ResultBean<List<HashMap<String, Object>>> getHomeCarousel() {
        return ResultBean.successResponse(homeManager.getHomeCarousel());
    }
}
